package com.oe.ldmrabbitmq.consumer;

import com.oe.ldmrabbitmq.service.OrderService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class OrderConsumer {

    @Autowired
    OrderService orderService;

    /**
     * 监听死信队列的订单消息,将订单状态置为超时未支付
     * @param orderId
     */
    @RabbitListener(queues = "queue.order.dlx")
    public void orderExpiredMsg(String orderId){
        orderService.expired(orderId);
    }
}
